package me.ywd.seckill.service;

import me.ywd.seckill.dto.Exposer;
import me.ywd.seckill.dto.SeckillExecution;
import me.ywd.seckill.entity.SeckillProduct;
import me.ywd.seckill.entity.Seckilled;
import me.ywd.seckill.exception.RepeatKillException;
import me.ywd.seckill.exception.SeckillCloseException;
import me.ywd.seckill.exception.SeckillException;

import java.util.List;

/**
 * Put yourself in the shoes of the users of the interface.
 */
public interface SeckillService {

    List<SeckillProduct> getProducts();

    SeckillProduct getProduct(long id);

    List<Seckilled> getKilled(String phone);

    List<Seckilled> getKilled(int productId);

    /**
     * Export url of second kill, if not begin, will export start time.
     * @param productId
     */
    Exposer exportSeckillUrl(long productId);

    /**
     * Execute second kill operation.
     * @param productId
     * @param phone
     * @param md5
     */
    SeckillExecution executeSeckill(long productId, String phone, String md5)
            throws SeckillException, RepeatKillException, SeckillCloseException;
}
